{% extends "CommonUserBundle::baseUser.html.twig" %}

{% block stylesheets %}
    {{ parent() }}
    {#<link href="{{ asset("library/dataTable/"~datatable_version~"/media/css/demo_table_jui.css") }}"  rel="stylesheet" type="text/css" />#}
    {#<link type="text/css" rel="stylesheet" href="{{asset('library/FontAwesome/css/font-awesome.min.css')}}" />#}
    <link type="text/css" rel="stylesheet" href="{{asset('css/fosuser.css')}}" />
{% endblock %}

{% block javascripts %}
    {{ parent() }}
    {#<script type="text/javascript" src="{{ asset("library/dataTable/"~datatable_version~"/media/js/jquery.datatables.js") }}"></script>#}
{% endblock %}

{% block subbody %}
    <script type="text/javascript">
        $(function()
        {
            var oTable = $('#tableauUser').dataTable(
                    {
                        "bJQueryUI": true,
                        "bFilter": true,
                        "bRetrieve":true,
                        "iDisplayLength": 50,
                        "sPaginationType": "full_numbers",
                        "oLanguage":
                        {
                            "sProcessing":     "Traitement en cours...",
                            "sLengthMenu":     "Afficher _MENU_ éléments",
                            "sZeroRecords":    "Aucun élément à afficher",
                            "sInfo":           "Affichage de l'élement _START_ à _END_ sur _TOTAL_ éléments",
                            "sInfoEmpty":      "Affichage de l'élement 0 à 0 sur 0 éléments",
                            "sInfoFiltered":   "(filtré de _MAX_ éléments au total)",
                            "sInfoPostFix":    "",
                            "sSearch":         "Rechercher :",
                            "sLoadingRecords": "Téléchargement...",
                            "sUrl":            "",
                            "oPaginate":
                            {
                                "sFirst":    "Premier",
                                "sPrevious": "Précédent",
                                "sNext":     "Suivant",
                                "sLast":     "Dernier"
                            }
                        },
                        "bAutoWidth":false
                    });
        });
    </script>
    <div class="container">
        <div class="title">
            <h2>User</h2>
        </div>
        <div id="user" class="well">
            <a href="{{ path('astotel_user_user_edit') }}" class="pull-right btn btn-mini btn-primary"><i class="icon-plus"></i> Ajouter un user</a>
            <table id="tableauUser" class="display table table-bordered table-striped">
                <thead>
                <tr>
                    <th>N°</th>
                    <th>Username</th>
                    <th>Email</th>
                    <th>Last login</th>
                    <th>Rôles</th>
                    <th></th>
                    <th></th>
                    <th></th>
                </tr>
                </thead>
                {% for user in users %}
                    <tr>
                        <td>{{user.id}}</td>
                        <td>{{user.username}}</td>
                        <td>{{user.email}}</td>
                        <td>{{user.lastlogin|date("d-m-Y H:i:s")}}</td>
                        <td>
                            {% for role in user.roles %}
                                {{ role }}<br/>
                            {% endfor %}
                        </td>
                        <td><a href="" class="btn btn-info btn-mini"><i class="icon-link"></i></a></td>
                        <td><a href="{{path("astotel_user_user_edit_1",{"id":user.id})}}" class="btn btn-info btn-mini"><i class="icon-edit"></i></a></td>
                        <td><a href="" class="btn btn-danger btn-mini"><i class="icon-remove"></i></a></td>
                    </tr>
                {% endfor %}
            </table>
        </div>
    </div>
{% endblock subbody %}